home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmMain
- BackColor = &H00C0C0C0&
- Caption = "Explicit vs. Variants"
- ClientHeight = 2970
- ClientLeft = 1095
- ClientTop = 1485
- ClientWidth = 4275
- Height = 3375
- Left = 1035
- LinkTopic = "Form1"
- ScaleHeight = 2970
- ScaleWidth = 4275
- Top = 1140
- Width = 4395
- Begin CommandButton cmdShowDlg
- Caption = "Explicit"
- Height = 495
- Index = 1
- Left = 1620
- TabIndex = 5
- Top = 2160
- Width = 1215
- End
- Begin CommandButton cmdShowDlg
- Caption = "Variant"
- Height = 495
- Index = 0
- Left = 1620
- TabIndex = 4
- Top = 1500
- Width = 1215
- End
- Begin TextBox txtUserInfo
- Height = 315
- Index = 1
- Left = 1260
- TabIndex = 2
- Top = 765
- Width = 1395
- End
- Begin TextBox txtUserInfo
- Height = 315
- Index = 0
- Left = 1260
- TabIndex = 0
- Top = 285
- Width = 2880
- End
- Begin Label lblUserInfo
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Enter Age:"
- Height = 190
- Index = 1
- Left = 320
- TabIndex = 3
- Top = 820
- Width = 915
- End
- Begin Label lblUserInfo
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Enter Name:"
- Height = 195
- Index = 0
- Left = 185
- TabIndex = 1
- Top = 345
- Width = 1065
- End
- Dim sName As String
- Dim iAge As Integer
- Sub cmdShowDlg_Click (Index As Integer)
- Select Case Index
- Case 0 ' Using Variants
- sName = txtUserInfo(0).Text
- iAge = txtUserInfo(1).Text
- VariantShowAge sName, iAge
- 'VariantShowAge iAge, sName
- Case 1 ' Using Sting and Integer
- sName = txtUserInfo(0).Text
- iAge = txtUserInfo(1).Text
- ExplicitShowAge sName, iAge
- 'ExplicitShowAge iAge, sName
- End Select
- End Sub
- Sub Command1_Click (Index As Integer)
- End Sub
- Sub ExplicitShowAge (sName1 As String, iAge1 As Integer)
- MsgBox sName1 & " is " & iAge1 & " years old.", 64, "Sample Output"
- End Sub
- Sub Form_Load ()
- frmMain.Left = (Screen.Width - frmMain.Width) / 2
- frmMain.Top = (Screen.Height - frmMain.Height) / 2
- End Sub
- Sub VariantShowAge (vAge1 As Variant, vName1 As Variant)
- MsgBox vName1 & " is " & vAge1 & " years old.", 64, "Sample Output"
- End Sub
-